home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 25 / AACD 25.iso / AACD / Graphics / PerfectPaint / rexx / general / SaveTransferAnim.rx < prev    next >
Encoding:
Text File  |  2001-04-20  |  3.0 KB  |  185 lines

  1. /*     arexx Script 
  2. */
  3.  
  4.     options results
  5.     parse ARG Port b
  6.     
  7.     ADDRESS value Port
  8.  
  9.     pp_GetDepth
  10.     D=result
  11.     pp_GetWidth
  12.     W=result
  13.     pp_GetHeight
  14.     H=result
  15.  
  16.     pp_CountFrames
  17.     count=result
  18.     IF count<2 then DO
  19.         pp_Warn 'Make*an*Anim*first.'
  20.         EXIT
  21.     END
  22.  
  23.     pp_GetCurrentBuffer
  24.     CBf=result
  25.     pp_GetCurrentBrush
  26.     B0=result
  27.  
  28.     if D<24 then DO
  29.         pp_Psave "ram:palette.trash" 0
  30.     END
  31.  
  32.     pp_FindEmptyBrush
  33.     Brush=result
  34.     if Brush=-1 then DO
  35.         pp_Warn "can't*find*empty|Brush."
  36.         EXIT        
  37.     END
  38.     pp_SetBrush Brush        
  39.  
  40.     pp_FindEMptyBuffer
  41.     Bf=result
  42.     if Bf=-1 then DO
  43.         pp_Warn "can't*find*empty|Buffer."
  44.         EXIT        
  45.     END
  46.     pp_SetBuffer Bf
  47.  
  48.     file="ram:"
  49.     type=0
  50.  
  51.     if EXISTS('PerfectPaint:Prefs/Rexx_Prefs/MkTransferAnim') THEN DO
  52.         IF OPEN('lfile','PerfectPaint:Prefs/Rexx_Prefs/MkTransferAnim', "R") then DO
  53.             file = READLN('lfile')
  54.             type=READLN('lfile')
  55.             if UPPER(file)='RAM DISK:' then DO
  56.                 file='ram:'
  57.             end
  58.             CALL CLOSE('lfile')
  59.             file2=""
  60.             do i=1 to LENGTH(file)
  61.                 a=SUBSTR(file,i,1)
  62.                 if a=" " then DO
  63.                     a="*"
  64.                 END
  65.                 file2=file2||a
  66.             END
  67.             file=file2
  68.         END
  69.     END
  70.  
  71.     pp_DialogInit 250 100 "*SAVE*Transfer*Animation" 3
  72.         pp_String 0 50 12 150 16 "Path" 1 100 file
  73.         pp_Getfile 1 205 13 0 "Select*Path" 1 file
  74.         pp_Cycle 2 70 40 100 16 "Browser" 1 "IBrowse|Aweb|Voyager" type
  75.     pp_Dialog    
  76.  
  77.     rc=result
  78.     if rc=0 then
  79.         do
  80.             pp_PermitRefresh            
  81.             EXIT
  82.         end    
  83.  
  84.     pp_GetDialog 0
  85.     file=result
  86.  
  87.     pp_GetDialog 2
  88.     type=result
  89.  
  90.             if Upper(file)='RAM DISK:' then DO
  91.                 file='ram:'
  92.             end
  93.  
  94.     CALL SavePrefs('MkTransferAnim',file,type)
  95.  
  96.     if type=0 then DO
  97.         file=file||'def_TransferAnimation'
  98.     END
  99.     IF type=1 then DO
  100.         file=file||'def_transferanim'
  101.     END
  102.     IF type=2 then DO
  103.         file=file||'TransferAnim'
  104.     END
  105.  
  106.     pp_New W*Count H D
  107.     pp_GetWidth
  108.     if result=0 then DO
  109.         pp_Warn "Not*enough*memory."
  110.         EXIT            
  111.     END
  112.  
  113.     if D<24 then DO
  114.         pp_Pload "ram:palette.trash"
  115.         ADDRESS COMMAND
  116.         'delete >nil: ram:palette.trash'
  117.         ADDRESS value Port
  118.     END
  119.  
  120.     pp_SetBuffer CBf
  121.     pp_GotoFrame 1
  122.  
  123.     DO i=1 to count
  124.         pp_Pickbrush 0 0 W H
  125.         X2=W/2+(i-1)*W
  126.         Y2=H/2    
  127.         pp_SetBuffer Bf
  128.         pp_plot x2 Y2 
  129.         pp_SetBuffer CBf
  130.         pp_NextFrame
  131.     END
  132.  
  133.     pp_SetBuffer Bf
  134.     pp_SavePrefs 0 1 100 0 0
  135.     pp_Save file
  136.     ADDRESS COMMAND
  137.     'copy PerfectPaint:Icons/Anim.info '||'"'||file||'"'||'.info'
  138.     ADDRESS value Port
  139.     IF type=0 then DO
  140.         PP_AddtoolType file 'WIDTH' W
  141.         pp_AddToolTYpe file 'HEIGHT' H
  142.         pp_AddToolType file 'FRAMES' count
  143.     END
  144.     IF type=1 then DO
  145.         pp_AddToolType file 'SIZE' W||","||H
  146.         pp_AddToolType file 'FIRST' "0,0"
  147.         pp_AddToolType file 'FRAMES' count
  148.         pp_AddToolType file 'DELTA' W||",0"
  149.         pp_AddToolType file 'REST' "0,0"        
  150.     END
  151.     IF type=2 then DO
  152.         pp_AddToolType file 'FRAMEWIDTH' W    
  153.     END
  154.  
  155.     pp_ClearCurrentBuffer
  156.     pp_SetBuffer CBf
  157.  
  158.     pp_FreeBrush
  159.     pp_SetBrush B0
  160.     
  161.     EXIT
  162.  
  163. SavePrefs: PROCEDURE
  164.     
  165.     Prefname='PerfectPaint:Prefs/Rexx_Prefs/'||ARG(1)
  166.  
  167.     if EXISTS(Prefname) THEN DO
  168.         ADDRESS COMMAND
  169.         'delete >nil: '||Prefname
  170.     END
  171.  
  172.     IF OPEN('pfile',PrefName,'W') THEN DO
  173.  
  174.     do i=2 to ARG()
  175.         CALL WRITELN('pfile',ARG(i))
  176.     end
  177.  
  178.     CALL CLOSE('pfile')
  179.  
  180. RETURN    
  181.  
  182.  
  183.     
  184.  
  185.